<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="魔镜,laravel,websocket,">










<meta name="description" content="项目涉及魔镜界面上的部分信息需要在某些情况下进行变更，若使用setTimeInterval不断地轮询后台，可行但很明显不是个好的方法。  很自然的就想到了websocket，因为后台已经使用了laravel，laravel的事件广播功能能够帮助实现这一功能。   关于websocket以前客户端想知道服务端的处理进度，要不停地使用 Ajax 进行轮询，让浏览器隔个几秒就向服务器发一次请求，这对服务">
<meta name="keywords" content="魔镜,laravel,websocket">
<meta property="og:type" content="article">
<meta property="og:title" content="魔镜开发日记(二)--laravel+pusher+vue进行websocket即时通讯">
<meta property="og:url" content="https://blog.emx6.com/2019/10/09/魔镜开发日记-二-laravel-pusher-vue进行websocket即时通讯/index.html">
<meta property="og:site_name" content="上帝不会掷骰子">
<meta property="og:description" content="项目涉及魔镜界面上的部分信息需要在某些情况下进行变更，若使用setTimeInterval不断地轮询后台，可行但很明显不是个好的方法。  很自然的就想到了websocket，因为后台已经使用了laravel，laravel的事件广播功能能够帮助实现这一功能。   关于websocket以前客户端想知道服务端的处理进度，要不停地使用 Ajax 进行轮询，让浏览器隔个几秒就向服务器发一次请求，这对服务">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://segmentfault.com/img/bV9Dfu?w=312&h=302">
<meta property="og:updated_time" content="2019-10-11T03:37:52.369Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="魔镜开发日记(二)--laravel+pusher+vue进行websocket即时通讯">
<meta name="twitter:description" content="项目涉及魔镜界面上的部分信息需要在某些情况下进行变更，若使用setTimeInterval不断地轮询后台，可行但很明显不是个好的方法。  很自然的就想到了websocket，因为后台已经使用了laravel，laravel的事件广播功能能够帮助实现这一功能。   关于websocket以前客户端想知道服务端的处理进度，要不停地使用 Ajax 进行轮询，让浏览器隔个几秒就向服务器发一次请求，这对服务">
<meta name="twitter:image" content="https://segmentfault.com/img/bV9Dfu?w=312&h=302">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://blog.emx6.com/2019/10/09/魔镜开发日记-二-laravel-pusher-vue进行websocket即时通讯/">





  <title>魔镜开发日记(二)--laravel+pusher+vue进行websocket即时通讯 | 上帝不会掷骰子</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">上帝不会掷骰子</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-schedule">
          <a href="/schedule/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br>
            
            日程表
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://blog.emx6.com/2019/10/09/魔镜开发日记-二-laravel-pusher-vue进行websocket即时通讯/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Glyn Yu">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="上帝不会掷骰子">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">魔镜开发日记(二)--laravel+pusher+vue进行websocket即时通讯</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-10-09T11:22:43+08:00">
                2019-10-09
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/物联网/" itemprop="url" rel="index">
                    <span itemprop="name">物联网</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-comment-o"></i>
              </span>
              
                <a href="/2019/10/09/魔镜开发日记-二-laravel-pusher-vue进行websocket即时通讯/#SOHUCS" itemprop="discussionUrl">
                  <span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="2019/10/09/魔镜开发日记-二-laravel-pusher-vue进行websocket即时通讯/" itemprop="commentsCount"></span>
                </a>
              
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </span></div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="项目涉及"><a href="#项目涉及" class="headerlink" title="项目涉及"></a>项目涉及</h3><p>魔镜界面上的部分信息需要在某些情况下进行变更，若使用setTimeInterval不断地轮询后台，可行但很明显不是个好的方法。 </p>
<p>很自然的就想到了websocket，因为后台已经使用了laravel，laravel的事件广播功能能够帮助实现这一功能。  </p>
<h3 id="关于websocket"><a href="#关于websocket" class="headerlink" title="关于websocket"></a>关于websocket</h3><p>以前客户端想知道服务端的处理进度，要不停地使用 Ajax 进行轮询，让浏览器隔个几秒就向服务器发一次请求，这对服务器压力较大。另外一种轮询就是采用 long poll 的方式，这就跟打电话差不多，没收到消息就一直不挂电话，也就是说，客户端发起连接后，如果没消息，就一直不返回 Response 给客户端，连接阶段一直是阻塞的。</p>
<p>WebSocket 是 HTML5 开始提供的一种在单个 TCP 连接上进行全双工通讯的协议。和HTTP没什么关系，是基于TCP的一种独立实现。</p>
<p>WebSocket 使得客户端和服务器之间的数据交换变得更加简单，允许服务端主动向客户端推送数据。在 WebSocket API 中，浏览器和服务器只需要完成一次握手，两者之间就直接可以创建持久性的连接，并进行双向数据传输。<br><img src="https://segmentfault.com/img/bV9Dfu?w=312&h=302" alt="websocket"></p>
<h3 id="laravel广播系统"><a href="#laravel广播系统" class="headerlink" title="laravel广播系统"></a>laravel广播系统</h3><h4 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h4><blockquote><p>广播系统的目的是用于实现当服务端完成某种特定功能后向客户端推送消息的功能。本文我们将学习如何使用第三方 Pusher 工具向客户端推送消息的功能。</p>
<p>如果您遇到在 Laravel 中需要实现当服务器处理完成某项工作后向客户端发送消息这类的功能，那么您需要使用到 Laravel 的广播系统。</p>
<p>比如在一个支持用户互相发送消息的即时通信应用，当用户 A 给用户 B 发送一条消息时，系统需要实时的将消息推送给用户 B，并且信息以弹出框或提示消息框形式展现给用户 B。</p>
<p>这种使用场景可以完美诠释 Laravel 广播系统的工作原理。另外，本教程将使用 Laravel 广播系统实现这样一个即时通信应用。</p>
<p>或许您会对服务器是如何将消息及时的推送给客户端的技术原理感兴趣，这是因为在服务端实现这类功能时使用了套接字编程技术。在开始实现即时通信系统前，先让我们了解下套接字编程的大致流程：</p>
<ul>
<li>首先，服务器需要支持 WebSocket 协议，并且允许客户端建立 WebSocket 连接；</li>
<li>您可以实现自己的 WebSocket 服务,或者使用第三方服务如 Pusher，后文会用到 Pusher 库；</li>
<li>客户端创建一个服务器的 Web Socket 连接，连接成功后客户端会获取唯一标识符；</li>
<li>一旦客户端连接成功，表示该客户端订阅了指定频道，将接收这个频道的消息；</li>
<li>最后，客户端还会注册其所订阅的频道的监听事件；</li>
<li>当服务端完成指定功能后，我们以指定频道名称和事件名称的信息通知到 WebSocket 服务器；</li>
<li>最终，WebSocket 服务器将这个指定事件已广播的形式推送到所有注册这个频道监听的客户端。</li>
</ul>
</blockquote>

<h4 id="服务端配置"><a href="#服务端配置" class="headerlink" title="服务端配置"></a>服务端配置</h4><ul>
<li><p>开启广播服务<br>在app.php中取消注释</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">// app.php</span><br><span class="line">App\Providers\BroadcastServiceProvider::class</span><br></pre></td></tr></table></figure>
</li>
<li><p>驱动<br>Laravel 自带了几个广播驱动： Pusher 、 Redis ， 和一个用于本地开发与调试的 log 驱动。<br>项目中使用pusher<br>使用composer安装pusher php sdk</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">composer require pusher/pusher-php-server &quot;~4.0&quot;</span><br></pre></td></tr></table></figure>

<p>  在pusher官网注册账号，建立项目，获取appid等信息。<br>  修改广播配置文件，config/broadcasting.php 或者直接修改env文件中pusher的配置信息。</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">BROADCAST_DRIVE=pusher</span><br><span class="line">PUSHER_APP_ID=‘’</span><br><span class="line">PUSHER_APP_KEY=‘’</span><br><span class="line">PUSHER_APP_SECRET=‘’</span><br><span class="line">PUSHER_APP_CLUSTER=‘’</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建广播事件</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">php artisan make:event PushAlarmEvent</span><br></pre></td></tr></table></figure>
</li>
<li><p>实现ShouldBroadcast接口</p>
  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">class PushAlarmEvent implements ShouldBroadcast</span><br><span class="line">&#123;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>broadcastOn方法<br> ShouldBroadcast 接口要求事件定义一个 broadcastOn 方法。该方法负责指定事件被广播到哪些频道。</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">public function broadcastOn()</span><br><span class="line">&#123;</span><br><span class="line">    return new Channel(&apos;alarm‘);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>数据<br>  可以在构造函数中拿数据作为公共属性</p>
</li>
<li><p>授权频道<br>  在 routes/channe.php参照样例，项目中未涉及</p>
</li>
</ul>
<h3 id="客户端监听"><a href="#客户端监听" class="headerlink" title="客户端监听"></a>客户端监听</h3><p>在laravel中可以用laravel-echo，不过魔镜项目是前后端分离的，前端采用的是Vue.</p>
<ul>
<li><p>安装pusher-js</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install pusher-js</span><br></pre></td></tr></table></figure>
</li>
<li><p>引入项目</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">import Pusher from ’pusher-js/dist/web/pusher.min&apos;</span><br></pre></td></tr></table></figure>

</li>
</ul>
<p>也可以把这个文件单独拿出来</p>
<ul>
<li>使用  <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">var pusher=new Pusher(&apos;pusher-key&apos;,&#123;</span><br><span class="line">    cluster:&apos;ap3&apos;,</span><br><span class="line">    forceTLS:true</span><br><span class="line">&#125;);</span><br><span class="line">var channel=pusher.subscribe(&apos;alarm&apos;);</span><br><span class="line">channel.bind(&apos;App\\Events\\PushAlarmEvent&apos;,function (data) &#123;</span><br><span class="line">    console.log(data);</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="结语"><a href="#结语" class="headerlink" title="结语"></a>结语</h3><p>于是乎，现在的警报流程变成了 </p>
<ol>
<li>树莓派向后台请求警报的api</li>
<li>后台进行相应的处理</li>
<li>后台通过pusher广播改事件</li>
<li>前台监听广播事件，做出修改</li>
</ol>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/魔镜/" rel="tag"># 魔镜</a>
          
            <a href="/tags/laravel/" rel="tag"># laravel</a>
          
            <a href="/tags/websocket/" rel="tag"># websocket</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/10/06/‘网络是怎样连接的’读书笔记-一-——生成HTTP请求消息/" rel="next" title="‘网络是怎样连接的’读书笔记(一)——生成HTTP请求消息">
                <i class="fa fa-chevron-left"></i> ‘网络是怎样连接的’读书笔记(一)——生成HTTP请求消息
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/10/11/魔镜开发日记-三-pusher-Python-Client/" rel="prev" title="魔镜开发日记(三)--pusher-Python-Client">
                魔镜开发日记(三)--pusher-Python-Client <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Glyn Yu</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">48</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/zjycp" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:chnzjycp@foxmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#项目涉及"><span class="nav-number">1.</span> <span class="nav-text">项目涉及</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关于websocket"><span class="nav-number">2.</span> <span class="nav-text">关于websocket</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#laravel广播系统"><span class="nav-number">3.</span> <span class="nav-text">laravel广播系统</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#介绍"><span class="nav-number">3.1.</span> <span class="nav-text">介绍</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#服务端配置"><span class="nav-number">3.2.</span> <span class="nav-text">服务端配置</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#客户端监听"><span class="nav-number">4.</span> <span class="nav-text">客户端监听</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#结语"><span class="nav-number">5.</span> <span class="nav-text">结语</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Glyn Yu</span>

  
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>








  <div style="display: none;">
    <script src="//s95.cnzz.com/z_stat.php?id=1277767124&web_id=1277767124" language="JavaScript"></script>
  </div>



        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  




  
    <script type="text/javascript">
    (function(){
      var appid = 'cyuiUNe9o';
      var conf = '7ce07412b2706ea50ada6a787faf513f';
      var width = window.innerWidth || document.documentElement.clientWidth;
      if (width < 960) {
      window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){
        window.changyan.api.config({appid:appid,conf:conf})});
      }
    })();
    </script>
    <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
  









  





  

  

  

  
  

  

  

  

</body>
</html>
